import platform # 获取设备的系统用来兼容mac和win

# VIVO手机的参数
VIVO = {
	"platformName": "Android",
	"platformVersion": "6.0.1",
	"deviceName": "vivo Y55L",
	"appPackage": "com.xingin.xhs",
	"appActivity": ".activity.SplashActivity",
	"unicodeKeyboard": True,
	"resetKeyboard": True,
	"noReset": True,
	"udid": "1151cc83",
	"newCommandTimeout": 6000,
	"ignoreUnimportantViews": False
	}

# LENOVO手机的参数
LENOVO = {
	"platformName": "Android",
	"platformVersion": "6.0.1",
	"deviceName": "lenovo",
	"appPackage": "com.xingin.xhs",
	"appActivity": ".activity.SplashActivity",
	"unicodeKeyboard": True,
	"resetKeyboard": True,
	"noReset": True,
	"udid": "4fcae4a0",
	"newCommandTimeout": 6000,
	"ignoreUnimportantViews": False
	}

# 网易安卓模拟器的参数
MUMU = {
	"platformName": "Android",
	"deviceName": "mumu",
	"platformVersion": "6.0.1",
	"appPackage": "com.xingin.xhs",
	"appActivity": ".activity.SplashActivity",
	"unicodeKeyboard": True,
	"resetKeyboard": True,
	"noReset": True,
	"udid": "emulator-5554",
	"newCommandTimeout": 6000,
	"ignoreUnimportantViews": False
	}

#红米的参数
R_MI_1 = {
	"platformName": "Android",
	"deviceName": "R_MI_1",
	"platformVersion": "5.0.2",
	"appPackage": "com.xingin.xhs",
	"appActivity": ".activity.SplashActivity",
	"unicodeKeyboard": True,
	"resetKeyboard": True,
	"noReset": True,
	"udid": "6LUS9PZ599999999",
	"newCommandTimeout": 6000,
	"ignoreUnimportantViews": False,
	}

#红米的参数
R_MI_2 = {
	"platformName": "Android",
	"deviceName": "R_MI_2",
	"platformVersion": "5.0.2",
	"appPackage": "com.xingin.xhs",
	"appActivity": ".activity.SplashActivity",
	"unicodeKeyboard": True,
	"resetKeyboard": True,
	"noReset": True,
	"udid": "TCTWUCSGQSIRS4AM",
	"newCommandTimeout": 6000,
	"ignoreUnimportantViews": False
	}

#红米的参数
R_MI_3 = {
	"platformName": "Android",
	"deviceName": "R_MI_3",
	"platformVersion": "5.0.2",
	"appPackage": "com.xingin.xhs",
	"appActivity": ".activity.SplashActivity",
	"unicodeKeyboard": True,
	"resetKeyboard": True,
	"noReset": True,
	"udid": "8TZ9UOCU9HAMEURO",
	"newCommandTimeout": 6000,
	"ignoreUnimportantViews": False
	}

# 浏览器的参数

# driver.start_activity(app_package = 'com.android.browser',
#                       app_activity = 'com.android.browser.BrowserActivity',
# 						autoGrantPermissions = True)

start_args = [
	# {'desired_capabilities':MUMU,'DRIVER_SERVER':'http://localhost:4723/wd/hub'}
#  ,
	{'desired_capabilities':VIVO,'DRIVER_SERVER':'http://localhost:4723/wd/hub'}
 ,
# 	{'desired_capabilities':LENOVO,'DRIVER_SERVER':'http://localhost:4725/wd/hub'}
#  ,
 	{'desired_capabilities':R_MI_1,'DRIVER_SERVER':'192.168.3.15:4727/wd/hub'}
 ,
	{'desired_capabilities':R_MI_2,'DRIVER_SERVER':'192.168.3.15:4729/wd/hub'}
#  ,	
# 	{'desired_capabilities':R_MI_3,'DRIVER_SERVER':'192.168.3.15:4731/wd/hub'}
# ,
	# {'desired_capabilities':LENOVO,'DRIVER_SERVER':'http://localhost:4725/wd/hub'}
]


headers = {
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cache-Control': 'no-cache',
    'Host': 'www.xiaohongshu.com',
	'Pragma': 'no-cache',
	'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
	'sec-ch-ua-mobile': '?0',
	'Sec-Fetch-Dest': 'document',
	'Sec-Fetch-Mode': 'navigate',
	'Sec-Fetch-Site': 'none',
	'Sec-Fetch-User': '?1',
	'Upgrade-Insecure-Requests': '1',
    'Connection': 'keep-alive',
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
}

mongodb = {
	"localhost":"mongodb://localhost:27017/",
	"txyun":"mongodb://1.117.86.134:27017/"
}

# 查询任务前的等待时间，全自动模式下建议3秒，半手动模式下建议20-30秒
VEIW_WAIT = 5

# 单次任务的循环次数上限，默认值2000，太多了容易异常，太短了降低效率
CYCLES_LIMIT = 2000

# 视图下拉的次数，避免因为异常查询到过久的图文浪费时间设定的下滑次数上限
SWIPE_COUNT = 5

# 循环重试次数，运行模式默认为50，调试的时候记得降低这个值
TRY_COUNT = 50

# 过滤掉的小任务
TASK_FILTER = 200

# webdrive的本机存放路径
if platform.platform() == 'macOS-10.16-x86_64-i386-64bit' :
	webdriver_path = r'/Applications/chromedriver'
else:
	webdriver_path = r'E:/Program Files (x86)/chromedriver'

# webdrive的超时时间
WEBDRIVER_IMPLICITLY_WAIT = 20